<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<#include "common/head.ftl">

<body class="fixed-sidebar full-height-layout gray-bg" style="overflow:hidden">
    <#include "common/entity.ftl">

    <#include "common/modal.ftl">
<div id="wrapper">
    <!--左侧导航开始-->
    <nav class="navbar-default navbar-static-side" role="navigation">
        <div class="sidebar-collapse">
            <ul class="nav" id="side-menu">
                <li class="nav-header">
                    <div class="dropdown profile-element">
                        <span><img alt="image" class="img-circle" src="${basePath}/function/getImage" width=80
                                   height=80/></span>
                        <a data-toggle="dropdown" class="dropdown-toggle" href="#">
                                <span class="clear">
                                <span class="text-muted text-xs block">${username}<b class="caret"></b></span>
                                </span>
                        </a>
                        <ul class="dropdown-menu animated fadeInRight m-t-xs">
                            <li>
                                <a href="javascript:void(0)" ;onclick="edit('修改个人资料','${modifyInfoUrl}','${modifyInfoUrl}','${oneselfInfoUrl}')">修改个人资料</a>
                            </li>
                            <li style="position: relative;">
                                <a href="javascript:void(0)" ;>上传头像</a>
                                <input name="upload" accept="image/*" type="file"style="width:100%;height:100%;cursor:pointer;opacity:0;position:absolute;top:0;">
                            </li>
                            <li>
                                <a href="javascript:void(0)" ;onclick="edit('修改密码','${basePath}/function/modifyPassword','${basePath}/function/modifyPassword')">修改密码</a>
                            </li>
                            <li class="divider"></li>
                            <li><a href="${basePath}/logout">安全退出</a>
                            </li>
                        </ul>
                    </div>
                </li>
                    <#include "common/function.ftl">
            </ul>
        </div>
    </nav>
    <!--左侧导航结束-->
    <!--右侧部分开始-->
    <div id="page-wrapper" class="gray-bg dashbard-1">
        <div class="row content-tabs">
        <#--<a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="#"><i class="fa fa-bars"></i> </a>-->
            <button class="roll-nav roll-left J_tabLeft"><i class="fa fa-backward"></i>
            </button>
            <nav class="page-tabs J_menuTabs">
                <div class="page-tabs-content">
                    <a class="active J_menuTab" data-id="${basePath}/func/showYe">首页</a>
                </div>
            </nav>
            <button class="roll-nav roll-right J_tabRight"><i class="fa fa-forward"></i>
            </button>
            <div class="btn-group roll-nav roll-right">
                <button class="dropdown J_tabClose" data-toggle="dropdown">关闭操作<span class="caret"></span></button>
                <ul role="menu" class="dropdown-menu dropdown-menu-right">
                    <li class="J_tabShowActive"><a>定位当前选项卡</a>
                    </li>
                    <li class="divider"></li>
                    <li class="J_tabCloseAll"><a>关闭全部选项卡</a>
                    </li>
                    <li class="J_tabCloseOther"><a>关闭其他选项卡</a>
                    </li>
                </ul>
            </div>
            <a href="${basePath}/logout" class="roll-nav roll-right J_tabExit"><i class="fa  fa-sign-out"></i> 退出</a>
        </div>
        <div class="row J_mainContent" id="content-main">
            <iframe class="J_iframe" name="iframe0" width="100%" height="100%" src="${basePath}/function/showYe"
                    frameborder="0" data-id="${basePath}/function/showYe" seamless></iframe>
        </div>
    </div>
</div>

<script src="${basePath}/js/jquery.min.js"></script>
<script src="${basePath}/js/bootstrap.min.js"></script>
<script src="${basePath}/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="${basePath}/js/plugins/metisMenu/hplus.js"></script>
<script src="${basePath}/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="${basePath}/js/plugins/slimscroll/contabs.js"></script>
<script src="${basePath}/js/common.js"></script>
<script>
    function edit(editTitle, htmlUrl, updateEntityUrl, getEntityUrl) {
        var $box = $('#EditEntity');
        $box.find('.modal-title').text(editTitle);
        $box.modal("show");
        $box.find('.modal-body').load(htmlUrl, function () {
            if (getEntityUrl != null) {
                $box.find('[onlyread]').prop("disabled", true);
                initFormData(getEntityUrl, null, $box.find(".modal-body form"));
                $box.find(".modal-footer button:last").unbind("click");
                $box.find(".modal-footer button:last").click(function () {
                    AsyncPost(updateEntityUrl, getFormData($box.find(".modal-body form")), function (value) {
                        if (value.code == 0) {
                            ShowMessage(value.msg);
                            $box.modal("hide");
                        } else {
                            ErrMessage(value.msg);
                        }
                    })
                })
            } else {
                $box.find(".modal-footer button:last").unbind("click");
                $box.find(".modal-footer button:last").click(function () {
                    AsyncPost(updateEntityUrl, getFormData($box.find(".modal-body form")), function (value) {
                        if (value.code == 0) {
                            ShowMessage(value.msg, function () {
                                window.location.href = "${basePath}/logout";
                            });
                        } else {
                            ErrMessage(value.msg);
                        }
                    })
                })
            }
        });
    }

    $("[name='upload']").change(function () {
        var formData = new FormData();
        formData.append('file', $("[name='upload']")[0].files[0]);
        $.ajax({
            url: "${basePath}/function/uploadImage",
            type: 'POST',
            data: formData,
            async: false,
            cache: false,
            contentType: false,
            processData: false,
            success: function (value) {
                if (value.code == 0) {
                    ShowMessage(value.msg);
                    $(".img-circle").attr("src", "${basePath}/function/getImage?time=" + new Date().getMilliseconds());
                } else {
                    ErrMessage(value.msg);
                }
            }
        });
    })
</script>
</body>
</html>
